/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.res0w.SMMS.ds;

import com.res0w.SMMS.factory.DataBaseOperate;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author res0w
 * @since 2009-9-22
 * @version 0.2
 */
public class SettingScheduleNormal implements BatchSqlInterface {

    public String hostName = null;
    public int hostYear = 0;
    public String hostSeason = null;
    public int bYear = 0;
    public int bMonth = 0;
    public int bDay = 0;
    public int eYear = 0;
    public int eMonth = 0;
    public int eDay = 0;

    public String[] exeSqls() {
        String[] sqls = new String[9];
        sqls[0] = "update setting_schedulenormal set hostName='" + hostName + "'";
        sqls[1] = "update setting_schedulenormal set hostYear='" + hostYear + "'";
        sqls[2] = "update setting_schedulenormal set hostSeason='" + hostSeason + "'";
        sqls[3] = "update setting_schedulenormal set bYear='" + bYear + "'";
        sqls[4] = "update setting_schedulenormal set bMonth='" + bMonth + "'";
        sqls[5] = "update setting_schedulenormal set bDay='" + bDay + "'";
        sqls[6] = "update setting_schedulenormal set eYear='" + eYear + "'";
        sqls[7] = "update setting_schedulenormal set eMonth='" + eMonth + "'";
        sqls[8] = "update setting_schedulenormal set eDay='" + eDay + "'";
        return sqls;
    }

    public void readSqls() {
//        throw new UnsupportedOperationException("Not supported yet.");
        try {
            DataBaseOperate db=new DataBaseOperate();
            ResultSet rs = null;
            String sql = null;
            sql = "select * from setting_schedulenormal";
            rs = db.dbQueryMuti(sql);
            while (rs.next()) {
                hostName = rs.getString(1);
                hostYear = Integer.parseInt(rs.getString(2));
                hostSeason = rs.getString(3);
                bYear = Integer.parseInt(rs.getString(4));
                bMonth = Integer.parseInt(rs.getString(5));
                bDay = Integer.parseInt(rs.getString(6));
                eYear = Integer.parseInt(rs.getString(7));
                eMonth = Integer.parseInt(rs.getString(8));
                eDay = Integer.parseInt(rs.getString(9));
            }
            db.dbClosed();
        } catch (SQLException ex) {
            Logger.getLogger(SettingScheduleNormal.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    /*
     * 测试模块
    public  static void main(String[] args){
    DataBaseOperate db=new DataBaseOperate();
    SettingScheduleNormal gsn=new SettingScheduleNormal();
    gsn.readSqls(db);
    System.out.println(gsn.hostName);
    //.....
    }
     */
}
